<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <title>OpenLayers: Sketch handlers crossing the dateline</title>
    <link rel="stylesheet" href="../../theme/default/style.css" type="text/css">
    <link rel="stylesheet" href="../../examples/style.css" type="text/css">
    <style type="text/css">
        #map {
            height: 512px;
        }
    </style>

    <script src="../../lib/OpenLayers.js"></script>
  </head>
  <body>
    <h1 id="title">OpenLayers sketch handlers crossing the dateline example</h1>

    <div id="tags">
        international date line, dateline, sketch
    </div>
    <p id="shortdesc">
        Start digitizing a polygon or line
        on one side of the international dateline, and then cross the dateline
        whilst digitizing. The feature should behave like digitizing on any
        other location.
    </p>
    <div id="map" class="smallmap"></div>

    <div id="docs">
    </div>
        <script type="text/javascript">

        var map = new OpenLayers.Map('map');

        var base = new OpenLayers.Layer.WMS("marble", 
            "http://demo.opengeo.org/geoserver/wms",
            {layers: "topp:naturalearth"},
            {wrapDateLine: true}
        );
        
        // allow testing of specific renderers via "?renderer=Canvas", etc
        var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
        renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;

        var vector = new OpenLayers.Layer.Vector("Editable Vectors", {renderers: renderer});

        map.addLayers([base, vector]);
        
        var wkt = new OpenLayers.Format.WKT();
        var f = wkt.read("POLYGON((210.8828125 39.7265625,151.8203125 36.2109375,152.171875 -9.4921875,219.3203125 -10.546875,210.8828125 39.7265625))");
        
        var f2 = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(-190, 0));
        
        vector.addFeatures([f, f2]);
        
        map.addControl(new OpenLayers.Control.EditingToolbar(vector));

        map.setCenter(new OpenLayers.LonLat(-179, 0), 2);

        </script>

  </body>
</html>
